# 
#  kernel/Makefile 
#  
#  last modified at 2007.07.14 22:16 by ChenJie
#

# 目标
TARGET		= drivers.o
OBJS		= at_wini/at_wini.o \
		  log/log.o \
		  mem/mem.o \
		  tty/tty.o


# 工具及参数定义
CC		= gcc -march=i486
LD		= ld
AR		= ar
CPP		= gcc -E -nostdinc -I../include
CFLAGS		= -Wall -fno-stack-protector -finline-functions -nostdinc -I../include 
LDFLAGS		= -r

# CFLAGS 中不能加入-O 的优化参数，否则运行就会出现保护错误，不知道是何原因
# 定义隐式规则
.c.o:
	$(CC) $(CFLAGS)	-c -o $*.o $<
.S.o:
	$(CC) $(CFLAGS) -c -o $*.o $<
.c.s:					
	$(CC) $(CFLAGS) -S -o $*.s $<
.s.o:
	$(CC) $(CFLAGS) -c -o $*.o $<

# All Phony Targets
.PHONY : all clean dep

# Default starting position
all : $(TARGET)

$(TARGET) : $(OBJS) 
	$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS)

at_wini/at_wini.o :
	(cd at_wini; make)

log/log.o :
	(cd log; make)

mem/mem.o :
	(cd mem; make)

tty/tty.o :
	(cd tty; make)

clean :
	rm -f $(TARGET) $(OBJS)
	(cd at_wini; make clean)
	(cd log; make clean)
	(cd mem; make clean)
	(cd tty; make clean)

dep:
	(cd at_wini; make dep)
	(cd log; make dep)
	(cd mem; make dep)
	(cd tty; make dep)

### Dependencies:
